package spring.aspectj.old;

import java.lang.reflect.Method;

import org.springframework.aop.AfterReturningAdvice;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.aop.ThrowsAdvice;

/**
 * 现在来定义真正的通知，通知包含应该干什么和何时干
 * @author Administrator
 *
 */
public class AudienceAdvice implements MethodBeforeAdvice,AfterReturningAdvice,ThrowsAdvice{
	private Audience audience;
	
	public void setAudience(Audience audience){
		this.audience=audience;
	}
	
	public void before(Method arg0, Object[] arg1, Object arg2)
			throws Throwable {
		audience.takeSeat();
		audience.turnOffMobilePhone();
	}

	public void afterReturning(Object arg0, Method arg1, Object[] arg2,
			Object arg3) throws Throwable {
		audience.appluad();
	}
	public void afterThrowing(Throwable throwable){
		audience.demandRefund();
	}

}
